package com.example.aicooking.service;

import com.example.aicooking.entity.Works;
import com.example.aicooking.entity.vo.WorksListVO;
import com.example.aicooking.util.Result;

import java.util.List;

public interface WorksService {
    public List<WorksListVO> getWorksList();

    public Works getWorksDetail(Integer worksId);

    public Works addWorks(Works works);

    public void toggleWorksStatus(Integer worksId, Integer userId, Integer status);

    public void deleteWorks(Integer worksId, Integer userId);

    public List<Works> getUserWorks(Integer userId);

    public Result<List<Works>> searchWorks(String keyword) {
        WorksService worksMapper
                ;
        List<Works> worksList = worksMapper.searchWorks("%" + keyword + "%"); // 使用通配符进行模糊查询
        if (worksList.isEmpty()) {
            return new Result<>(0, "未找到相关作品", null);
        }
        return new Result<>(1, "查询成功", worksList);
    }

}
